import 'package:color_dart/RgbaColor.dart';
import 'package:flutter/material.dart';
import 'package:im_flutter_sdk_example/jsonserialize/project/data.dart';

import 'basicinfo.dart';

class MainPage extends StatelessWidget {
  final ProjectItem item;
  const MainPage({Key key, this.item}) : super(key: key);
  Widget space(Widget child) {
    return Container(
      margin: EdgeInsets.only(right: 6),
      child: child,
    );
  }

  @override
  Widget build(BuildContext context) {
    final TextStyle richText1 =
        TextStyle(color: rgba(134, 86, 8, 1), fontSize: 12);
    final TextStyle richText2 = TextStyle(
        color: rgba(134, 86, 8, 1), fontSize: 17, fontWeight: FontWeight.bold);
    return Container(
      decoration: BoxDecoration(
          borderRadius: BorderRadius.only(
              topLeft: Radius.circular(20), topRight: Radius.circular(20))),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            color: Colors.white,
            padding: EdgeInsets.symmetric(vertical: 20, horizontal: 16),
            child:
                Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
              Text('${item.projectName}',
                  style: TextStyle(
                      color: rgba(68, 68, 68, 1),
                      fontSize: 17,
                      fontWeight: FontWeight.bold)),
              Container(
                padding: EdgeInsets.only(bottom: 18, top: 10),
                child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          Text('${item.browseNum}',
                              style: TextStyle(
                                  color: rgba(51, 51, 51, 1), fontSize: 12)),
                          Container(
                            margin: EdgeInsets.only(left: 4, right: 10),
                            child: Text('浏览',
                                style: TextStyle(
                                    color: rgba(163, 163, 163, 1),
                                    fontSize: 12)),
                          ),
                          Text('0',
                              style: TextStyle(
                                  color: rgba(51, 51, 51, 1), fontSize: 12)),
                          Container(
                            margin: EdgeInsets.only(left: 4, right: 10),
                            child: Text('评论',
                                style: TextStyle(
                                    color: rgba(163, 163, 163, 1),
                                    fontSize: 12)),
                          ),
                        ],
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          SizedBox(
                            width: 9,
                            height: 11,
                            child: Image.asset(
                              'lib/assets/images/label/label_position.png',
                              fit: BoxFit.contain,
                            ),
                          ),
                          Container(
                              child: Text('${item.cityName}',
                                  style: TextStyle(
                                      color: rgba(163, 163, 163, 1),
                                      fontSize: 12)),
                              margin: EdgeInsets.only(left: 3)),
                        ],
                      ),
                    ]),
              ),
            ]),
          ),
          Container(
            color: rgba(253, 243, 228, 1),
            padding: EdgeInsets.symmetric(horizontal: 15),
            height: 45,
            child: Row(
              children: [
                Text('项目动态',
                    style: TextStyle(color: rgba(134, 86, 8, 1), fontSize: 15)),
                Container(
                  margin: EdgeInsets.only(left: 20),
                  child: RichText(
                    text: TextSpan(
                        style: DefaultTextStyle.of(context).style,
                        children: <InlineSpan>[
                          TextSpan(text: '已有 ', style: richText1),
                          TextSpan(text: '5', style: richText2),
                          TextSpan(text: ' 个单位感兴趣，', style: richText1),
                          TextSpan(text: '2', style: richText2),
                          TextSpan(text: ' 个正在咨询', style: richText1),
                        ]),
                  ),
                )
              ],
            ),
          ),
          Container(
            color: Colors.white,
            padding: EdgeInsets.symmetric(vertical: 20, horizontal: 16),
            child:
                Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
              Row(children: [
                SizedBox(
                  width: 12,
                  height: 12,
                  child: Image.asset(
                    'lib/assets/images/label/label.png',
                    fit: BoxFit.cover,
                  ),
                ),
                Text(
                  ' ${item.yourWant.join('、')}',
                  style: TextStyle(color: rgba(235, 101, 13, 1), fontSize: 15),
                )
              ]),
              Container(
                  margin: EdgeInsets.only(top: 20, bottom: 12),
                  child: Text('${item.yourWantContent}',
                      style:
                          TextStyle(color: rgba(68, 68, 68, 1), fontSize: 14))),
            ]),
          ),
          BasicInfo()
        ],
      ),
    );
  }
}
